<template>
  <div>
      购买数量：
      <div class="mui-numbox" data-numbox-step='1' data-numbox-min='0' :data-numbox-max='max'>
        
        <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
        <input class="mui-numbox-input" type="number" v-model="count"  @change="childnum()" ref="boxnum"/>
        <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
    </div>
  </div>
</template>
<script>
import mui from '../../assets/mui/js/mui.min.js';
    export default {
        data(){
            return {
                count:1
            }
        },
        created(){
             console.log(this.count)
        },
        mounted(){
            mui('.mui-numbox').numbox().getValue()
        },
        methods:{
            childnum(){
                this.$emit('getchildnum',parseInt(this.$refs.boxnum.value))
                console.log(this.count)

            }
        },
        props:["max"],
        watch:{
            max:function(newval,oldval){
                this.max = newval
                
            }
        }
    }
</script>
<style lang="scss" scoped>

</style>

